package com.company.demo_main;

import com.company.service.UserService;
import com.company.service.impl.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @ClassName UserController
 * @Description
 */
public class UserController {
    public static void main(String[] args) {
        /* 01. 如果配置文件中没有的配置 Service 的写法 */
//        UserService userService = new UserServiceImpl();
//        userService.save();

        /* 在配置文件中 配置了 Service 的写法 */
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = (UserService) app.getBean("userService");
        userService.save();
    }
}
